<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

function format_price($price, $name) {
    if ($price == '') {
        return '';
    }

    // Remove anything that isn't a number or decimal point.
    $price = trim(preg_replace('/([^0-9\.])/i', '', $price));

    return number_format($price,0, '.', ',') . " ". $name;
}

?>